package com.zmn.brs.services.impl.task.version;

import com.zmn.brs.model.entity.task.version.TaskVersion;
import com.zmn.brs.model.entity.task.version.TaskVersionQuery;
import com.zmn.brs.persistence.interfaces.task.version.TaskVersionDao;
import com.zmn.brs.services.interfaces.task.version.TaskVersionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;



@Service
public class TaskVersionServiceImpl implements TaskVersionService {

    @Resource
    TaskVersionDao taskVersionDao;

    @Override
    public TaskVersion findByKey(Integer id) {
        return taskVersionDao.findByKey(id);
    }

    /**
     * 根据任务版本查询
     * @param taskVersionId ID
     * @return
     */
    @Override
    public TaskVersion findByVersion(String taskVersionId){
        return taskVersionDao.findByVersion(taskVersionId);
    }

    @Override
    public List<TaskVersion> listPageByQuery(TaskVersionQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return taskVersionDao.listPageByQuery(query);
    }

    @Override
    public List<TaskVersion> listByQuery(TaskVersionQuery query) {
        return taskVersionDao.listByQuery(query);
    }

    @Override
    public List<TaskVersion> listAll() {
        return taskVersionDao.listAll();
    }

    @Override
    public Integer countByQuery(TaskVersionQuery query) {
        return taskVersionDao.countByQuery(query);
    }
    @Override
    public Integer updateStatusByKey(TaskVersion taskVersion) {
        return taskVersionDao.updateStatusByKey(taskVersion);
    }

    @Override
    public Integer updateStatusBatchByKey(List<Integer> ids, Integer status, String mcStaffName) {
        return taskVersionDao.updateBatchStatusByKey(ids, status, mcStaffName);
    }
    @Override
    public Integer updateByKey(TaskVersion taskVersion) {
        return taskVersionDao.updateByKey(taskVersion);
    }

    @Override
    public Integer insert(TaskVersion taskVersion) {
        return taskVersionDao.insert(taskVersion);
    }

    @Override
    public Integer deleteByKey(Integer id) {
        return taskVersionDao.deleteByKey(id);
    }

}